package com.xc.quickstart.manager.oa;

import com.xc.quickstart.manager.oa.model.FeignOaTokenResponseModel;
import com.xc.quickstart.manager.oa.model.OaTokenModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author wzp
 * @version 1.0
 * @description
 * @date 2021/1/8 10:59
 */
@FeignClient(value = "OA-client", url = "${oa.root_path}", configuration = OaClient.OAClientConfig.class)
interface OaClient {
    /**
     * Feign配置类 配置打印日志
     *
     * @create 2021年1月8日11:13:08
     */
    class OAClientConfig {
        @Bean
        public feign.Logger.Level multipartLoggerLevel() {
            return feign.Logger.Level.FULL;
        }
    }

    /**
     * 获取OA系统的接口调用Token
     *
     * @param appkey
     * @return
     */
    @GetMapping(value = "/api/verify/auth/generateToken", consumes = MediaType.APPLICATION_JSON_VALUE)
    FeignOaTokenResponseModel<OaTokenModel> generateToken(@RequestParam("appkey") String appkey);
}
